home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 20 / Cream of the Crop 20 (Terry Blount) (1996).iso / doom / ds100p2.zip / SETUP.RUL < prev    next >
Text File  |  1996-04-14  |  11KB  |  343 lines

  1. /*-----------------------------------------------------------------------------
  2. Descent Studio Installation Script
  3. ------------------------------------------------------------------------------*/
  4.  
  5. #define SIZE_REQ_PROGRAM   500000
  6.  
  7. #define APP_NAME           "Descent Studio Pre-Release 2"
  8. #define PROGRAM_GROUP_NAME "Descent Studio Pre-Release 2"
  9. #define APPBASE_PATH       "JeffFerguson@msn.com\\Descent Studio Pre-Release 2\\"
  10. #define COMPANY_NAME       "JeffFerguson@msn.com"
  11. #define PRODUCT_NAME       "Descent Studio Pre-Release 2"
  12.  
  13. #define PRODUCT_VERSION    "1.0.0"
  14. #define PRODUCT_KEY        "Descent Studio.exe"
  15. #define UNINSTALL_KEY      "Descent Studio Pre-Release 2"
  16. #define APPBASE_DIR95      "Program Files"
  17.  
  18. #define PROGRAM_FILENAME   "Descent Studio.exe"
  19. #define HELP_FILENAME      "Descent Studio.hlp"
  20.  
  21. #define STR_COMPLETE95     "by selecting the program icon in the Programs menu.\n\n"
  22. #define STR_COMPLETENT     "by selecting the program icon in the program group.\n\n"
  23.  
  24. declare
  25.  
  26.         // global variable declarations
  27.  
  28.         STRING  svGrp;
  29.         STRING  szMsg;
  30.         STRING  szFileSet;
  31.         STRING  szTitle;
  32.         STRING  szAppPath;
  33.         STRING  szAppSharedDir;
  34.     STRING  szHelp;
  35.         STRING  szProgram;
  36.         STRING  szTemp;
  37.         STRING  svUninstLogFile;
  38.         STRING  szRegKey;
  39.         STRING  svMainDirectory[_MAX_STRING];
  40.         BOOL    bSpaceOk;
  41.         BOOL    bReshowSetupType;
  42.         NUMBER  nResult;
  43.         NUMBER  nStatusId;
  44.         NUMBER  nType;
  45.         BOOL    bIncludeProgram;
  46.         BOOL    bIncludeSamples;
  47.         BOOL    bIncludeHelp;
  48.         BOOL    bWinNT;
  49.         BOOL    bWin95;
  50.  
  51.         // function declarations
  52.  
  53.         prototype SetupScreen();
  54.         prototype CheckRequirements();
  55.         prototype CheckSpaceRequirements( number, number, number, string );
  56.         prototype CreateRegDBEntries();
  57.  
  58. program
  59.  
  60. StartHere:
  61.         Disable(BACKGROUND);
  62.  
  63.         // Set up the installation screen.
  64.  
  65.         SetupScreen();
  66.  
  67.         // Set installation info., which is required for registry entries.
  68.  
  69.         InstallationInfo(COMPANY_NAME, PRODUCT_NAME, PRODUCT_VERSION, PRODUCT_KEY);
  70.  
  71. // Create a Welcome dialog.
  72.  
  73. WelcomeDlg:
  74.         Disable(BACKBUTTON);
  75.         Welcome("", 0);
  76.         Enable(BACKBUTTON);
  77.  
  78.         // Test target system proper configuration.
  79.  
  80.         CheckRequirements();
  81.  
  82. // Ask user for a destination location for the installation.
  83.  
  84. GetTargetDirectory:
  85.         svMainDirectory = TARGETDISK ^ APPBASE_DIR95 ^ APPBASE_PATH;
  86.         szMsg = "";
  87.         if (AskDestPath("", szMsg, svMainDirectory, 0) = BACK) then
  88.            goto WelcomeDlg;
  89.         endif;
  90.         szAppSharedDir = svMainDirectory ^ "System";
  91.  
  92. FolderSelection:
  93.  
  94.     svGrp = PROGRAM_GROUP_NAME;
  95.  
  96.     // Allow user to modify folder name.
  97.  
  98.     if(SelectFolder("", svGrp, svGrp) = BACK) then
  99.         goto GetTargetDirectory;
  100.     endif;
  101.  
  102. FileTransferSetup:
  103.  
  104.         // Prepare InstallShield to record deinstallation information.
  105.  
  106.         DeinstallStart(svMainDirectory, svUninstLogFile, UNINSTALL_KEY, 0);
  107.         RegDBSetItem(REGDB_UNINSTALL_NAME, APP_NAME);
  108.  
  109.         // Set registry App Paths key information for the main application.
  110.  
  111.         szAppPath = svMainDirectory + ";" + szAppSharedDir;
  112.         RegDBSetItem(REGDB_APPPATH, szAppPath);
  113.         szProgram = svMainDirectory ^ PROGRAM_FILENAME;
  114.         RegDBSetItem(REGDB_APPPATH_DEFAULT, szProgram);
  115.  
  116.         // Define the "General" file set.
  117.  
  118.         szFileSet = "General";
  119.         TARGETDIR = svMainDirectory;
  120.         FileSetBeginDefine(szFileSet);
  121.         TARGETDIR = svMainDirectory;
  122.         CompressGet("program.z", "*.*", COMP_NORMAL);
  123.         TARGETDIR = szAppSharedDir;
  124.         CompressGet("system.z", "*.*", COMP_NORMAL);
  125.         FileSetEndDefine(szFileSet);
  126.  
  127. DoFileTransfer:
  128.  
  129.         // Set up progress indicator and information gauge.
  130.  
  131.         Enable(STATUSDLG);
  132.     Enable(INDVFILESTATUS);
  133.         SetStatusWindow(0, "Copying program files..." );
  134.         StatusUpdate(ON, 100);
  135.  
  136.         // Perform the file set.
  137.  
  138.         nResult = FileSetPerformEz(szFileSet, 0);
  139.         switch (nResult)
  140.             case FS_DONE: // Successful completion.
  141.             case FS_CREATEDIR: // Create directory error.
  142.             MessageBox("Unable to create a directory under " + TARGETDIR + ". Please check write access to this directory.", SEVERE);
  143.                      abort;
  144.             default: // Group all other errors under default label.
  145.                 NumToStr(szTemp, nResult);
  146.                      MessageBox( "General file transfer error. Please check your target location and try again.\n\n Error Number:"+szTemp, SEVERE);
  147.                      abort;
  148.         endswitch;
  149.  
  150. SetRegistryEntries:
  151.  
  152.         CreateRegDBEntries();
  153.         Delay(2);
  154.         Disable(STATUSDLG);
  155.  
  156.         // Create program groups (folders) and icons.
  157.  
  158. CreateFolderIcons:
  159.  
  160.         SetStatusWindow(100, "Creating Folder and Icons...." );
  161.         CreateProgramFolder(svGrp);
  162.         LongPathToShortPath(svMainDirectory);
  163.         Delay(1);
  164.  
  165.         TARGETDIR = svMainDirectory;
  166.  
  167.         szProgram = TARGETDIR ^ PROGRAM_FILENAME;
  168.     if(bWin95 = TRUE) then
  169.         LongPathToQuote(szProgram, TRUE);
  170.     endif;
  171.     if(bWinNT = TRUE) then
  172.         LongPathToShortPath(szProgram);
  173.     endif;
  174.      AddFolderIcon(svGrp, APP_NAME, szProgram, TARGETDIR, "", 0, "", REPLACE);
  175.         Delay(1);
  176.  
  177.         szHelp = szAppSharedDir ^ HELP_FILENAME;
  178.     if(bWin95 = TRUE) then
  179.         LongPathToQuote(szHelp, TRUE);
  180.         LongPathToQuote(szAppSharedDir, TRUE);
  181.     endif;
  182.     if(bWinNT = TRUE) then
  183.         LongPathToShortPath(szHelp);
  184.         LongPathToShortPath(szAppSharedDir);
  185.     endif;
  186.      AddFolderIcon(svGrp, APP_NAME + " Help", szHelp, szAppSharedDir, "", 0, "", REPLACE);
  187.         Delay(1);
  188.  
  189.         szProgram = WINDIR ^ "UNINST.EXE";
  190.         LongPathToShortPath(svUninstLogFile);
  191.         AddFolderIcon(svGrp, "Remove " + APP_NAME, szProgram + " -f" + svUninstLogFile, WINDIR, "", 0, "", REPLACE);
  192.         Delay(1);
  193.  
  194.         // Announce setup complete and offer to read README file.
  195.  
  196.         SetStatusWindow(100, "Installation complete.");
  197.         szMsg = "Setup is complete.  You may run the installed program ";
  198.         if(bWinNT = TRUE) then
  199.           szMsg = szMsg + STR_COMPLETENT;
  200.         else
  201.           szMsg = szMsg + STR_COMPLETE95;
  202.         endif;
  203.  
  204.         MessageBeep(0);
  205.         MessageBox(szMsg, INFORMATION);
  206.  
  207.         exit;
  208.  
  209.  
  210. /*---------------------------------------------------------------------------*\
  211.  *
  212.  * Function:  SetupScreen
  213.  *
  214.  *  Purpose:  This function will set up the screen look.  This includes
  215.  *            colors, fonts, text to be displayed, etc.
  216.  *
  217.  *
  218.  *    Input:
  219.  *
  220.  *  Returns:
  221.  *
  222.  * Comments:
  223. \*---------------------------------------------------------------------------*/
  224.  
  225. function SetupScreen()
  226.         begin
  227.  
  228.           Enable(INDVFILESTATUS);
  229.           SetTitle(APP_NAME + " Setup", 24, WHITE);
  230.           SetTitle("Setup", 0, BACKGROUNDCAPTION); // Caption bar text.
  231.           Enable(BACKGROUND);
  232.  
  233.         end;
  234.  
  235.  
  236. /*---------------------------------------------------------------------------*\
  237.  *
  238.  * Function:  CheckRequirements
  239.  *
  240.  *  Purpose:  This function will check all minimum requirements for the
  241.  *            application being installed.  If any fail, then the user
  242.  *            is informed and the installation is terminated.
  243.  *
  244.  *
  245.  *    Input:
  246.  *
  247.  *  Returns:
  248.  *
  249.  * Comments:
  250. \*---------------------------------------------------------------------------*/
  251.  
  252. function CheckRequirements()
  253.           number nvDx;
  254.           NUMBER nvDy;
  255.           number nvResult;
  256.           STRING szResult;
  257.         begin
  258.  
  259.           // Determine if target system uses NT or Windows 95.
  260.  
  261.           GetSystemInfo( WINMAJOR, nvResult, szResult );
  262.           bWin95 = TRUE;
  263.           bWinNT = FALSE;
  264.           if (nvResult = 4) then
  265.              bWinNT = FALSE; // Running Windows 95.
  266.              bWin95 = TRUE;
  267.           endif;
  268.  
  269.           // Check screen resolution.
  270.  
  271.           GetExtents( nvDx, nvDy );
  272.           if (nvDy < 480) then
  273.